package com.jida.hadoop.mr.PV;

 
import com.jida.hadoop.mr.tools.TProperties;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
 
import java.io.IOException;
 
/**
 * 个人行为数据统计：识别用户高频访问地址（pv数）
 */
public class MapPvNumMapper extends Mapper<LongWritable,Text,Text,IntWritable> {
    Text tk = new Text();
    IntWritable iw = new IntWritable(1);
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String[] vs = value.toString().split(TProperties.getValue("fileoutsplit"));
        tk.set(vs[0].substring(0,6)+"000000000000"+TProperties.getValue("outfilesplit")
                +vs[1]);//一级域名的行为ID|用户ID
        context.write(tk,iw);
    }
}
